﻿using K9Nano.Updater.Utils;

namespace K9Nano.Updater;

/// <summary>
/// 更新文件
/// </summary>
public class TargetFile
{
    /// <summary>
    /// 相对于更新包目录的文件路径
    /// </summary>
    public string FileUri { get; set; }

    /// <summary>
    /// 相对于更新目录的文件存放路径
    /// </summary>
    public string TargetPath { get; set; }

    /// <summary>
    /// 文件哈希值
    /// </summary>
    public string Hash { get; set; }

    /// <summary>
    /// 文件更新操作
    /// </summary>
    public EInstallAction Action { get; set; }

    /// <summary>
    /// 获取存放路径
    /// </summary>
    /// <param name="directory">存放目录</param>
    /// <returns></returns>
    public string GetSavePath(string directory)
    {
        return PathUtils.CombineFileUri(directory, FileUri);
    }
}
